package com.pjedu.nbmallshop.service;

import com.pjedu.nbmallcommon.utils.PageResult;
import com.pjedu.nbmallshop.entity.MallOrder;
import com.pjedu.nbmallshop.vo.MallOrderDetailVO;
import com.pjedu.nbmallshop.vo.MallOrderItemVO;
import com.pjedu.nbmallshop.vo.MallShoppingCartItemVO;
import com.pjedu.nbmalluser.entity.MallUser;
import com.alipay.api.AlipayApiException;

import java.util.HashMap;

import java.util.List;
import java.util.Map;

public interface MallOrderService {
    /**
     * 后台分页
     *
     * @param pageUtil
     * @return
     */
    PageResult getMallOrdersPage(HashMap pageUtil);

    /**
     * 订单信息修改
     *
     * @param mallOrder
     * @return
     */
    String updateOrderInfo(MallOrder mallOrder);

    /**
     * 配货
     *
     * @param ids
     * @return
     */
    String checkDone(Long[] ids);

    /**
     * 出库
     *
     * @param ids
     * @return
     */
    String checkOut(Long[] ids);

    /**
     * 关闭订单
     *
     * @param ids
     * @return
     */
    String closeOrder(Long[] ids);

    /**
     * 保存订单
     *
     * @param user
     * @param myShoppingCartItems
     * @return
     */
    String saveOrder(MallUser user, List<MallShoppingCartItemVO> myShoppingCartItems, int payType);

    /**
     * 获取订单详情
     *
     * @param orderNo
     * @param userId
     * @return
     */
    MallOrderDetailVO getOrderDetailByOrderNo(String orderNo, Long userId);

    /**
     * 获取订单详情
     *
     * @param orderNo
     * @return
     */
    MallOrder getMallOrderByOrderNo(String orderNo);

    /**
     * 我的订单列表
     *
     * @param pageUtil
     * @return
     */
    PageResult getMyOrders(HashMap pageUtil);

    /**
     * 手动取消订单
     *
     * @param orderNo
     * @param userId
     * @return
     */
    String cancelOrder(String orderNo, Long userId);

    /**
     * 确认收货
     *
     * @param orderNo
     * @param userId
     * @return
     */
    String finishOrder(String orderNo, Long userId);

    /**
     * 如果确实已经支付，则返回订单信息
     * @param param
     * @return
     */
    MallOrder paySuccess(Map<String, String> param) throws AlipayApiException, Exception;

    List<MallOrderItemVO> getOrderItems(Long id);
}
